package com.me.jingdongshop.presenter;

import android.os.Message;

import com.me.common.base.BaseView;
import com.me.jingdongshop.model.protocol.BaseProtocol;
import com.me.jingdongshop.model.protocol.CommonProtocol;

/**
 * Created on 2017/5/5.
 * P层获取数据后回调给View层
 * @author Chilam
 */

public class BasePresenter {
    public BaseView mBaseView;

    public CommonProtocol mProtocol = new CommonProtocol();

    public BasePresenter(BaseView baseView){
        this.mBaseView = baseView;
    }

    public BaseProtocol.HttpCallback mBaseCallback = new BaseProtocol.HttpCallback() {
        @Override
        public void onHttpSuccess(int reqType, Message msg) {
            //请求成功，回调数据到View层
            mBaseView.onHttpSuccess(reqType,msg);
        }

        @Override
        public void onHttpError(int reqType, String error) {
            //请求失败
            mBaseView.onHttpError(reqType, error);
        }
    };
}
